home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / PInterfaces / CMApplication.p < prev    next >
Encoding:
Text File  |  1994-07-21  |  10.9 KB  |  412 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        CMApplication.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.1  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT CMApplication;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __CMAPPLICATION__}
  27. {$SETC __CMAPPLICATION__ := 1}
  28.  
  29. {$I+}
  30. {$SETC CMApplicationIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __QUICKDRAW__}
  40. {$I Quickdraw.p}
  41. {$ENDC}
  42. {    MixedMode.p                                                    }
  43. {    QuickdrawText.p                                                }
  44.  
  45. {$IFC UNDEFINED __WINDOWS__}
  46. {$I Windows.p}
  47. {$ENDC}
  48. {    Memory.p                                                    }
  49. {    Events.p                                                    }
  50. {        OSUtils.p                                                }
  51. {    Controls.p                                                    }
  52. {        Menus.p                                                    }
  53.  
  54. {$IFC UNDEFINED __PRINTING__}
  55. {$I Printing.p}
  56. {$ENDC}
  57. {    Errors.p                                                    }
  58. {    Dialogs.p                                                    }
  59. {        TextEdit.p                                                }
  60.  
  61. {$PUSH}
  62. {$ALIGN MAC68K}
  63. {$LibExport+}
  64.  
  65. CONST
  66.     gestaltColorMatchingVersion    = 'cmtc';
  67.  
  68.     gestaltColorSync10            = $0100;                        { 0x0100 & 0x0110 _Gestalt versions for 1.0-1.0.3 product }
  69.     gestaltColorSync11            = $0110;                        {   0x0100 == low-level matching only }
  70.     gestaltColorSync104            = $0104;                        { Real version, by popular demand }
  71.     gestaltColorSync105            = $0105;
  72.  
  73.     gestaltColorMatchingAttr    = 'cmta';
  74.  
  75. { Attribute bit numbers for gestaltColorMatchingAttr }
  76.     gestaltHighLevelMatching    = 0;
  77.     gestaltColorMatchingLibLoaded = 1;
  78.  
  79. { 68K A-trap }
  80.     CMTrap                        = $ABEE;
  81.  
  82. { PicComments }
  83.     CMBeginProfile                = 220;
  84.     CMEndProfile                = 221;
  85.     CMEnableMatching            = 222;
  86.     CMDisableMatching            = 223;
  87.  
  88. { Defines for fieldMask in profile search record }
  89.     kMatchCMMType                = $00000001;
  90.     kMatchApplProfileVersion    = $00000002;
  91.     kMatchDataType                = $00000004;
  92.     kMatchDeviceType            = $00000008;
  93.     kMatchDeviceManufacturer    = $00000010;
  94.     kMatchDeviceModel            = $00000020;
  95.     kMatchDeviceAttributes        = $00000040;
  96.     kMatchFlags                    = $00000080;
  97.     kMatchOptions                = $00000100;
  98.     kMatchWhite                    = $00000200;
  99.     kMatchBlack                    = $00000400;
  100.  
  101. { Profile Header version }
  102.     kCMApplProfileVersion        = $0100;
  103.  
  104. { Data types }
  105.     rgbData                        = 'RGB ';
  106.     cmykData                    = 'CMYK';
  107.     grayData                    = 'GRAY';
  108.     xyzData                        = 'XYZ ';
  109.  
  110. { Device types }
  111.     monitorDevice                = 'mntr';
  112.     scannerDevice                = 'scnr';
  113.     printerDevice                = 'prtr';
  114.     qdSystemDevice                = 'sys ';
  115.     qdGDevice                    = 'gdev';
  116.  
  117. { Profile flags }
  118.     CMNativeMatchingPreferred    = $00000001;                    { Default to native not preferred }
  119.     CMTurnOffCache                = $00000002;                    { Default to turn on CMM cache }
  120.  
  121.     
  122. TYPE
  123. CMMatchFlag = LONGINT;
  124.  
  125. { Profile options }
  126.  
  127. CONST
  128.     CMPerceptualMatch            = $0000;                        { Default. For photographic images }
  129.     CMColorimetricMatch            = $0001;                        { Exact matching when possible }
  130.     CMSaturationMatch            = $0002;                        { For solid colors }
  131.  
  132.     
  133. TYPE
  134. CMMatchOption = LONGINT;
  135.  
  136.     CMMatchRef = LONGINT;
  137.  
  138.     CWorld = LONGINT;
  139.  
  140. { ColorSync result codes }
  141.  
  142. CONST
  143.     CMNoError                    = 0;
  144.     CMProfileError                = -170;
  145.     CMMethodError                = -171;
  146.     CMMemFullError                = -172;
  147.     CMUnimplementedError        = -173;
  148.     CMParamError                = -174;
  149.     CMMethodNotFound            = -175;                            { CMM not present }
  150.     CMProfileNotFound            = -176;                            { Responder error }
  151.     CMProfilesIdentical            = -177;                            { Profiles the same }
  152.     CMCantConcatenateError        = -178;                            { Profile can't be concatenated }
  153.     CMCantXYZ                    = -179;                            { CMM cant handle XYZ space }
  154.     CMCantDeleteProfile            = -180;                            { Responder error }
  155.     CMUnsupportedDataType        = -181;                            { Responder error }
  156.     CMNoCurrentProfile            = -182;                            { Responder error }
  157.  
  158.     
  159. TYPE
  160. CMError = LONGINT;
  161.  
  162. {
  163. ** Types
  164. }
  165.     XYZColor = RECORD
  166.         X:                        INTEGER;                                { 1.15 bit unsigned fixed numbers }
  167.         Y:                        INTEGER;
  168.         Z:                        INTEGER;
  169.     END;
  170.     CMYKColor = RECORD
  171.         cyan:                    INTEGER;
  172.         magenta:                INTEGER;
  173.         yellow:                    INTEGER;
  174.         black:                    INTEGER;
  175.     END;
  176.     CMColor = RECORD
  177.         CASE INTEGER OF
  178.         0: (
  179.             rgb:                        RGBColor;
  180.            );
  181.         1: (
  182.             xyz:                        XYZColor;
  183.            );
  184.         2: (
  185.             cmyk:                        CMYKColor;
  186.            );
  187.     END;
  188.  
  189.     CMColorList = ^CMColor;
  190.  
  191.     CMGamutResult = ^LONGINT;
  192.  
  193.     CMHeader = RECORD
  194.         size:                    LONGINT;                                { This is the total size of the Profile including custom data }
  195.         CMMType:                OSType;                                    { Corresponding CMM }
  196.         applProfileVersion:        LONGINT;                                { Version of CMProfile format }
  197.         dataType:                OSType;                                    { rgbData, etc. }
  198.         deviceType:                OSType;                                    { monitorDevice, etc. }
  199.         deviceManufacturer:        OSType;                                    { Registered with DTS }
  200.         deviceModel:            LONGINT;                                { Specific to Manufacturer }
  201.         deviceAttributes:        ARRAY [0..1] OF LONGINT;                { Attributes like paper, ink, etc. }
  202.         profileNameOffset:        LONGINT;                                { Offset to profile name from top of data }
  203.         customDataOffset:        LONGINT;                                { Offset to custom data from top of data }
  204.         flags:                    CMMatchFlag;
  205.         options:                CMMatchOption;
  206.         white:                    XYZColor;
  207.         black:                    XYZColor;
  208.     END;
  209.     CMProfileSearchRecord = RECORD
  210.         header:                    CMHeader;
  211.         fieldMask:                LONGINT;
  212.         reserved:                ARRAY [0..1] OF LONGINT;
  213.     END;
  214.     CMProfileSearchRecordPtr = ^CMProfileSearchRecord;
  215.     CMProfileSearchRecordHandle = ^CMProfileSearchRecordPtr;
  216.  
  217.     CMProfileChromaticities = RECORD
  218.         red:                    XYZColor;
  219.         green:                    XYZColor;
  220.         blue:                    XYZColor;
  221.         cyan:                    XYZColor;
  222.         magenta:                XYZColor;
  223.         yellow:                    XYZColor;
  224.     END;
  225.     CMResponseData = INTEGER;
  226.  
  227.     IString = RECORD
  228.         theScript:                ScriptCode;
  229.         theString:                Str63;
  230.     END;
  231.     IStringPtr = ^IString;
  232.     IStringHandle = ^IStringPtr;
  233.  
  234.  
  235. CONST
  236.     grayResponse                = 0;
  237.     redResponse                    = 1;
  238.     greenResponse                = 2;
  239.     blueResponse                = 3;
  240.     cyanResponse                = 4;
  241.     magentaResponse                = 5;
  242.     yellowResponse                = 6;
  243.     ucrResponse                    = 7;
  244.     bgResponse                    = 8;
  245.     onePlusLastResponse            = 9;
  246.  
  247.     
  248. TYPE
  249. responseColor = LONGINT;
  250.  
  251.     CMProfileResponse = RECORD
  252.         counts:                    ARRAY [0..onePlusLastResponse-1] OF INTEGER;
  253.         data:                    ARRAY [0..0] OF CMResponseData;            { Variable size }
  254.     END;
  255.     CMProfile = RECORD
  256.         header:                    CMHeader;
  257.         profile:                CMProfileChromaticities;
  258.         response:                CMProfileResponse;                        { Variable size }
  259.         profileName:            IString;                                { Variable size }
  260.         customData:                ARRAY [0..0] OF CHAR;                    { Optional variable length custom CMM data }
  261.     END;
  262.     CMProfilePtr = ^CMProfile;
  263.     CMProfileHandle = ^CMProfilePtr;
  264.  
  265.     PixMapCallBackProcPtr = ProcPtr;  { FUNCTION PixMapCallBack(progress: LONGINT; refCon: LONGINT): BOOLEAN; }
  266.     PixMapCallBackUPP = UniversalProcPtr;
  267.  
  268. CONST
  269.     uppPixMapCallBackProcInfo = $000003D0; { FUNCTION (4 byte param, 4 byte param): 1 byte result; }
  270.  
  271. FUNCTION NewPixMapCallBackProc(userRoutine: PixMapCallBackProcPtr): PixMapCallBackUPP;
  272.     {$IFC NOT GENERATINGCFM }
  273.     INLINE $2E9F;
  274.     {$ENDC}
  275.  
  276. FUNCTION CallPixMapCallBackProc(progress: LONGINT; refCon: LONGINT; userRoutine: PixMapCallBackUPP): BOOLEAN;
  277.     {$IFC NOT GENERATINGCFM}
  278.     INLINE $205F, $4E90;
  279.     {$ENDC}
  280. {
  281. ** Printing Stuff that will be moved later
  282. }
  283.  
  284. CONST
  285.     enableColorMatchingOp        = 12;
  286.     registerProfileOp            = 13;
  287.  
  288. { PrGeneral parameter blocks }
  289.  
  290. TYPE
  291.     TEnableColorMatchingBlk = RECORD
  292.         iOpCode:                INTEGER;
  293.         iError:                    INTEGER;
  294.         lReserved:                LONGINT;
  295.         hPrint:                    THPrint;
  296.         fEnableIt:                BOOLEAN;
  297.     END;
  298.     TRegisterProfileBlk = RECORD
  299.         iOpCode:                INTEGER;
  300.         iError:                    INTEGER;
  301.         lReserved:                LONGINT;
  302.         hPrint:                    THPrint;
  303.         fRegisterIt:            BOOLEAN;
  304.     END;
  305. {
  306. ** High Level Calls
  307. }
  308.  
  309. FUNCTION BeginMatching(src: CMProfileHandle; dst: CMProfileHandle; VAR myRef: CMMatchRef): CMError;
  310.     {$IFC NOT GENERATINGCFM}
  311.     INLINE $203c, $000C, 10, $ABEE;
  312.     {$ENDC}
  313. PROCEDURE EndMatching(myRef: CMMatchRef);
  314.     {$IFC NOT GENERATINGCFM}
  315.     INLINE $203c, $0004, 11, $ABEE;
  316.     {$ENDC}
  317. FUNCTION GetProfile(deviceType: LONGINT; refNum: LONGINT; aProfile: CMProfileHandle; VAR returnedProfile: CMProfileHandle): CMError;
  318.     {$IFC NOT GENERATINGCFM}
  319.     INLINE $203c, $0010, 5, $ABEE;
  320.     {$ENDC}
  321. FUNCTION SetProfile(deviceType: LONGINT; refNum: LONGINT; newProfile: CMProfileHandle): CMError;
  322.     {$IFC NOT GENERATINGCFM}
  323.     INLINE $203c, $000c, 6, $ABEE;
  324.     {$ENDC}
  325. FUNCTION SetProfileDescription(deviceType: LONGINT; refNum: LONGINT; deviceData: LONGINT; hProfile: CMProfileHandle): CMError;
  326.     {$IFC NOT GENERATINGCFM}
  327.     INLINE $203c, $0010, 16, $ABEE;
  328.     {$ENDC}
  329. FUNCTION GetColorSyncFolderSpec(vRefNum: INTEGER; createFolder: BOOLEAN; VAR foundVRefNum: INTEGER; VAR foundDirID: LONGINT): CMError;
  330.     {$IFC NOT GENERATINGCFM}
  331.     INLINE $203c, $000c, 17, $ABEE;
  332.     {$ENDC}
  333. FUNCTION GetIndexedProfile(deviceType: LONGINT; refNum: LONGINT; search: CMProfileSearchRecordHandle; VAR returnProfile: CMProfileHandle; VAR index: LONGINT): CMError;
  334.     {$IFC NOT GENERATINGCFM}
  335.     INLINE $203c, $0014, 18, $ABEE;
  336.     {$ENDC}
  337. FUNCTION DeleteDeviceProfile(deviceType: LONGINT; refNum: LONGINT; deleteMe: CMProfileHandle): CMError;
  338.     {$IFC NOT GENERATINGCFM}
  339.     INLINE $203c, $000C, 19, $ABEE;
  340.     {$ENDC}
  341. {
  342. ** Data interchange routines
  343. }
  344. FUNCTION UseProfile(profile: CMProfileHandle): CMError;
  345.     {$IFC NOT GENERATINGCFM}
  346.     INLINE $203c, $0004, 8, $ABEE;
  347.     {$ENDC}
  348. PROCEDURE DrawMatchedPicture(myPicture: PicHandle; dst: CMProfileHandle; VAR myRect: Rect);
  349.     {$IFC NOT GENERATINGCFM}
  350.     INLINE $203c, $000C, 9, $ABEE;
  351.     {$ENDC}
  352. PROCEDURE EnableMatching(enableIt: BOOLEAN);
  353.     {$IFC NOT GENERATINGCFM}
  354.     INLINE $203c, $0002, 13, $ABEE;
  355.     {$ENDC}
  356. {
  357. ** Profile concatenation
  358. }
  359. FUNCTION ConcatenateProfiles(thru: CMProfileHandle; dst: CMProfileHandle; VAR newDst: CMProfileHandle): CMError;
  360.     {$IFC NOT GENERATINGCFM}
  361.     INLINE $203c, $000C, 12, $ABEE;
  362.     {$ENDC}
  363. {
  364. ** Profile manipulation routines
  365. }
  366. PROCEDURE GetProfileName(myProfile: CMProfileHandle; VAR IStringResult: IString);
  367.     {$IFC NOT GENERATINGCFM}
  368.     INLINE $203c, $0008, 14, $ABEE;
  369.     {$ENDC}
  370. FUNCTION GetProfileAdditionalDataOffset(myProfile: CMProfileHandle): LONGINT;
  371.     {$IFC NOT GENERATINGCFM}
  372.     INLINE $203c, $0004, 15, $ABEE;
  373.     {$ENDC}
  374. {
  375. ** Low level color calculation routines
  376. }
  377. FUNCTION CWNewColorWorld(VAR myCWorld: CWorld; src: CMProfileHandle; dst: CMProfileHandle): CMError;
  378.     {$IFC NOT GENERATINGCFM}
  379.     INLINE $203c, $000C, 0, $ABEE;
  380.     {$ENDC}
  381. PROCEDURE CWDisposeColorWorld(myCWorld: CWorld);
  382.     {$IFC NOT GENERATINGCFM}
  383.     INLINE $203c, $0004, 1, $ABEE;
  384.     {$ENDC}
  385. FUNCTION CWMatchColors(myCWorld: CWorld; myColors: CMColorList; count: LONGINT): CMError;
  386.     {$IFC NOT GENERATINGCFM}
  387.     INLINE $203c, $000c, 2, $ABEE;
  388.     {$ENDC}
  389. FUNCTION CWCheckColors(myCWorld: CWorld; myColors: CMColorList; count: LONGINT; result: CMGamutResult): CMError;
  390.     {$IFC NOT GENERATINGCFM}
  391.     INLINE $203c, $0010, 3, $ABEE;
  392.     {$ENDC}
  393. FUNCTION CWMatchPixMap(myCWorld: CWorld; VAR myPixMap: PixMap; progressProc: PixMapCallBackUPP; refCon: LONGINT): CMError;
  394.     {$IFC NOT GENERATINGCFM}
  395.     INLINE $203c, $0010, 4, $ABEE;
  396.     {$ENDC}
  397. FUNCTION CWCheckPixMap(myCWorld: CWorld; VAR myPixMap: PixMap; progressProc: PixMapCallBackUPP; refCon: LONGINT; VAR resultBitMap: BitMap): CMError;
  398.     {$IFC NOT GENERATINGCFM}
  399.     INLINE $203c, $0014, 7, $ABEE;
  400.     {$ENDC}
  401.  
  402. {$ALIGN RESET}
  403. {$POP}
  404.  
  405. {$SETC UsingIncludes := CMApplicationIncludes}
  406.  
  407. {$ENDC} {__CMAPPLICATION__}
  408.  
  409. {$IFC NOT UsingIncludes}
  410.  END.
  411. {$ENDC}
  412.